<?php echo $header; ?>
<div id="content">
    <div class="breadcrumb">
        <?php echo $this->breadCrumbs(); ?>
    </div>
    <?php if (isset($error_warning)) { ?>
    <div class="warning"><?php echo $error_warning; ?></div>
    <?php } ?>
    <?php if ($success) { ?>
    <div class="success"><?php echo $success; ?></div>
    <?php } ?>
    <div class="box">

        <div class="heading">
            <h1><img src="view/image/payment.png" alt="" /> <?php echo $_['heading_title']; ?></h1>
            <div class="buttons">
                <a href="<?php echo UA('sale/couponcard/update'); ?>" class="button"><?php echo $_['text_edit'] ; ?></a>
                <a href="<?php echo UA('sale/couponcard/insert'); ?>" class="button"><?php echo $_['button_insert']; ?></a>
                <a onclick="document.getElementById('form').submit();" class="button"><?php echo $_['button_delete']; ?></a></div>
        </div>

    
        <div class="content">
            <form action="<?php echo UA('sale/couponcard/delete'); ?>" method="post" enctype="multipart/form-data" id="form">
                <table class="list">
                    <thead>
                      <tr>
                         <td width="1" style="text-align: center;"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></td>
                         <td width="750" class="center" >
                            <a #><?php echo $_['couponcard_range'] ; ?></a>
                         </td>
                         <td class="center">
                              <a #><?php echo $_['couponcard_reward']; ?></a>
                         </td>
                      </tr>
                   </thead>

                  <tbody>
                    <?php if ($couponcards) { ?>
                    <?php foreach ($couponcards as $couponcard) { ?>
                    <tr>
                        <td style="text-align: center;">
                            <input type="checkbox" name="selected[]" value="<?php echo $couponcard['couponID']; ?>" />
                        </td>
                        <td class="center"><?php echo $couponcard['lowAmount']; ?>&nbsp;&nbsp;&nbsp;&nbsp;~&nbsp;&nbsp;&nbsp;&nbsp;<?php echo $couponcard['highAmount']; ?></td>
                        <td class="center"><?php echo $couponcard['reward']?></td>
                    </tr>

                    <?php } ?>
                    <?php } else { ?>
                    <tr>
                        <td class="center" colspan="9"><?php echo $_['text_no_results']; ?></td>
                    </tr>
                    <?php } ?>

    
                    </tbody>
                </table>
            </form>
            <div class="pagination"><?php echo $pagination; ?></div>
        </div>
    </div>
</div>


<script type="text/javascript"><!--
    function sendCouponcard(couponID) {
        $.ajax({
            url: '<?php echo UA('sale/couponccard/update'); ?>&couponID=' + couponID;
                type: 'post',
                dataType: 'json',
                beforeSend: function() {
            $('.success, .warning').remove();
            $('.box').before('<div class="attention"><img src="view/image/loading.gif" alt="" /> <?php echo $_['text_wait']; ?></div>');
        },
        complete: function() {
            $('.attention').remove();
        },
        success: function(json) {
            if (json['error']) {
                $('.box').before('<div class="warning">' + json['error'] + '</div>');
            }

            if (json['success']) {
                $('.box').before('<div class="success">' + json['success'] + '</div>');
            }
        }
    });
    }
    //--></script>
<?php echo $footer; ?>